import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
import QtMultimedia 5.0

ApplicationWindow{
    visible: true
    width: 320; height: 480

    Camera{
        id: camera;
        captureMode: Camera.CaptureStillImage
        imageCapture{
            onImageCaptured: {
                photoPreview.source = preview
            }
        }
    }

    VideoOutput{
        id: videoFinder
        source: camera
        focus: true
        anchors.left: parent.left
        anchors.top: parent.top
        width: 320; height: 320
        orientation: -90
    }

    Image {
        id: photoPreview
        anchors.left: parent.left
        anchors.top: videoFinder.bottom
        anchors.topMargin: 4
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        fillMode: Image.PreserveAspectFit
    }

    Button{
        id: takePhoto
        text: "Play"
        onClicked: camera.imageCapture.capture();
        anchors.left: parent.left
        anchors.leftMargin: 4
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 4
        z: 6
    }
}
